package com.ztesoft.web.baseconfig.db.dao.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;

import com.ztesoft.framework.exception.BaseAppException;
import com.ztesoft.web.baseconfig.db.arg.DmStrategyArg;
import com.ztesoft.web.baseconfig.db.po.DmStrategyPO;
import com.ztesoft.web.baseconfig.db.po.StrategyNodePO;

public interface IDmStrategyMapper {

	List<Integer> countByArg(DmStrategyArg arg);

	List<DmStrategyPO> selectByArg(DmStrategyArg arg);

	List<DmStrategyPO> selectByPlanId(Integer dmPlanId);

	/**
	 * 策略树
	 * 
	 * @return
	 */
	List<StrategyNodePO> selectAllForTree(DmStrategyPO record);

	DmStrategyPO selectByPrimaryKey(Integer id);

	/**
	 * 根据源数据表名获取策略信息
	 * 
	 * @param tableName
	 * @return
	 */
	DmStrategyPO selectBySrcTableName(String tableName);

	/**
	 * 获取有关策略的所有信息，包括源数据、目标数据等
	 * 
	 * @param dmStrategyId
	 * @return
	 * @throws BaseAppException
	 */
	DmStrategyPO getStrategyAllInfo(Integer id);

	/**
	 * 查询是否存在相同名称的策略
	 * 
	 * @param strategyName
	 * @return
	 */
	int selectByStrategyName(String strategyName);

	List<DmStrategyPO> selectByArgAndPage(DmStrategyArg arg, RowBounds rowBound);

	int insert(DmStrategyPO record);

	int insertSelective(DmStrategyPO record);

	int insertBatch(@Param("list") List<DmStrategyPO> records);

	int updateByArgSelective(@Param("record") DmStrategyPO record, @Param("arg") DmStrategyArg arg);

	int updateDToA(Integer dmStrategyId);
	int updateTo00X(Integer dmStrategyId);

	int updateByArg(@Param("record") DmStrategyPO record, @Param("arg") DmStrategyArg arg);

	int updateByPrimaryKeySelective(DmStrategyPO record);

	int updateByPrimaryKey(DmStrategyPO record);

	int deleteByArg(DmStrategyArg arg);

	int deleteByPrimaryKey(DmStrategyPO record);

}